<?php
namespace App\Api;
use App\Model\Mir4GetUI as Mir4GetUImd;
use PhalApi\Api;

use App\Domain\Mir4GetUI as Mir4GetUIdm;


/**
 * 传奇4接口
 * @author: dogstar <chanzonghuang@gmail.com> 2014-10-04
 */
class Mir4GetUI extends Api {
    public function getRules() {
        return array(
            'UI'       => array(
                'imei'  => array('name' => 'imei', 'require' => true, 'desc' => 'imei'),
                'username'  => array('name' => 'username', 'require' => true, 'desc' => 'username'),
                'name'  => array('name' => 'name', 'require' => true, 'desc' => 'name'),
            ),
        );
    }

    /**
     * 传奇取UI接口
     * @desc 默认接口服务，当未指定接口服务时执行此接口服务
     * @return string title 标题
     * @return string content 内容
     * @return string version 版本，格式：X.X.X
     * @return int time 当前时间戳
     * @exception 400 非法请求，参数传递错误
     */
    public function UI() {
        // 最简单的处理方式
        header('Access-Control-Allow-Origin: *');
        header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
        header('Access-Control-Allow-Headers: *');

        $where = array(
            'imei' => $this->imei,
            'username' => $this->username,
            'name' => $this->name,
        );

        //按条件读取UI
        $Domian = new Mir4GetUIdm();
        return $Domian->Mir4GetUI($where);

    }




}
